import $api from '.';

interface staff {
  name: string;
  number: number | string;
  [key: string]: any;
}

// 添加店铺
export const addstaff = function (data: staff) {
  return $api.post('/stafflist', data);
};

// 获取店铺列表
export const getstaffList = function (data: { [key: string]: any; }) {
  console.log('data', data);
  data.$limit = data.$limit || 20;
  data.$skip = data.$skip || 0;
  return $api.get('/stafflist', {
    params: data,
  });
};

// 删除店铺
export const delstaff = function (id: number) {
  return $api.delete(`/stafflist/${id}`);
};

// 修改店铺信息
export const updatestaff = function (id: number, data: any) {
  return $api.patch(`/stafflist/${id}`, data);
};
// 搜索店铺信息
export const searchstaff = function (data: { $limit: number; $skip: number; staffname: string; state: number}) {
  console.log('data', data);
  data.$limit = data.$limit || 20;
  data.$skip = data.$skip || 0;
  return $api.get('/stafflist', {
    params: data,
  });
};

export default {};
